///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include <Scene/Culling/Sphere.h>
#include <Math/Vec3f.h>

//-----------------------------------------------------------------------------

Sphere::Sphere( const Vec3f &center, f32 radius )
{
	setSphere( center, radius );
}

//-----------------------------------------------------------------------------

Sphere::Sphere(void)
{
	m_center.x = 0;
	m_center.y = 0;
	m_center.z = 0;

	m_radius = 0;
}

//-----------------------------------------------------------------------------

Sphere::~Sphere()
{
}

//-----------------------------------------------------------------------------

void Sphere::setSphere( const Vec3f &center, f32 radius )
{
	m_center = center;
	m_radius = radius;
}

//-----------------------------------------------------------------------------

Vec3f	Sphere::getCenter()
{
	return m_center;
}

//-----------------------------------------------------------------------------

f32		Sphere::getRadius()
{
	return m_radius;
}

//-----------------------------------------------------------------------------

#if defined(DEBUG)
void	Sphere::draw()
{
	glPushMatrix();
	glTranslatef( m_center.x, m_center.y, m_center.z );
	glutWireSphere( m_radius, 30, 30 );
	glPopMatrix();
}
//#include <Scene/Object.h>
//#include <Scene/SceneManager.h>
//#include <Scene/Camera/Camera.h>
//#include <Math/Vec4f.h>
void	Sphere::draw(Object *obj)
{
	glPushMatrix();
	
	//glLoadMatrixf( (const f32*)mat.m );
	
	glTranslatef( m_center.x, m_center.y, m_center.z );
	
	//Vec4f x(m_center);
	//x *= obj->GetAbsoluteTransform() * obj->GetSceneManager()->GetCamera()->getViewMatrix();
	//glLoadIdentity();
	//glTranslatef( x.x, x.y, x.z );

	glutWireSphere( m_radius, 30, 30 );
	glPopMatrix();
}
#endif

//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
